
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>魅族商城</title>
    <meta name="keywords" content="魅族官方在线商店、魅族在线商城、魅族官网在线商店、魅族商城、魅族、魅族手机">
    <meta name="description" content="魅族商城是魅族面向全国服务的官方电商平台，提供魅族 PRO 系列、MX系列、魅蓝note系列和魅蓝metal系列的手机，配件和智能硬件的预约和购买。官方正品，全国联保，全场包邮，7天无理由退货，15天换货保障。">
    <meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1,minimum-scale=1,user-scalable=no"/>
    <meta name="_token" content="{{csrf_token()}}">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="format-detection" content="telephone=no,email=no"/>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">
    <meta property="qc:admins" content="415077624446551256375" />
    <script>!function(d){var c=d.document;var a=c.documentElement;var b=d.devicePixelRatio;var f;function e(){var h=a.getBoundingClientRect().width,g;if(b===1){h=720}g=h/10;a.style.fontSize=g+"px"}if(b>2){b=3}else{if(b>1){b=2}else{b=1}}a.setAttribute("data-dpr",b);d.addEventListener("resize",function(){clearTimeout(f);f=setTimeout(e,200)},false);e()}(window);</script>

    <link rel="stylesheet" href="/css/member-84bf9d5964.css"/>
    <link rel="icon" href="/favicon.ico" mce_href="/favicon.ico" type="image/x-icon">
    <link rel="shortcut icon" href="/favicon.ico" mce_href="/favicon.ico" type="image/x-icon">
    <script src="/layui/layui.js"></script>
    <script>
        layui.use('jquery',function () {
            var $ = layui.jquery;
            $.ajaxSetup({
                headers: {
                    'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content')
                }
            });
        })

    </script>
</head>
<body>
<div class="app address">
    <div id="scroll-wrap" class="scroll-wrap">
        <div class="scroll-view">
            <div class="head-title" id="header">
                <a href="/home/account"><i class="iconfont icon-arrow-left"></i></a>
                <span>收货地址</span>
            </div>
            <script>
                if (/MzmApp/.test(navigator.userAgent)) {
                    document.getElementById('header').remove();
                }
            </script>

            <div class="maincon">
                <div class="address-box">
                    <!-- 添加地址 -->
                    <a class="addr-add" href="/add/address">
                        <span class="icon ico-add">添加收货人信息</span>
                    </a>
                    @foreach ($user->address as $address)
                        <div id="addr-list" class="addr-list" data-action="/home/address/set_default">
                        <div class="addr-sheet  j_sheet" data-id="7132369702000">
                            <div class="addr  j_addr @if ($address->id == $user->address_id)
                                checked
                            @endif">
                                <div class="addr-txt">
                                    <p class="person orient-h">
                                        <span class="name cell">{{$address->name}}</span>
                                        <span class="phone cell">{{$address->phone}}</span>
                                    </p>
                                    <p>{{$address->citydesc}} {{$address->address}}</p>
                                </div>
                                <p class="addr-foo">
                                    <a address_id = {{$address->id}} class="icon ico-radio j-setdef check">设为默认收货地址</a>
                                </p>
                            </div>
                            <div class="addr-ctrl">
                                <a class="icon ico-del j_del deladdress" address_id = {{$address->id}}  data-action="/home/address/remove">删除</a>
                                <a class="icon ico-edit" href="/editAddress/{{$address->id}}">编辑</a>
                            </div>
                        </div>
                    </div><!-- .addr-list -->
                    @endforeach
                    
                </div><!-- .address-box -->
            </div><!-- .maincon -->
        </div><!-- .scroll-view -->
    </div><!-- .scroll-wrap -->

    <div id="go-top" class="go-top">
        <span class="icon ico-gotop"></span>
    </div>

</div><!-- .app -->

<script defer src="//mall.res.meizu.com/lib/zepto/zepto.js"></script>
<script defer src="//mall.res.meizu.com/member/js/address-352fc62ada.js"></script>

<script>
    var __mzt = __mzt || [];
    (function() {
        var hm = document.createElement("script");
        hm.async = true;
        hm.src = "//sccom.res.meizu.com/js/analytics-min.js";
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

<script>
    var _hmt = _hmt || [];
    (function() {
        var hm = document.createElement("script");
        hm.src = "//hm.baidu.com/hm.js?dd784e4788615e02f7a07fd1bed20cad";
        hm.async = true;
        var s = document.getElementsByTagName("script")[0];
        s.parentNode.insertBefore(hm, s);
    })();
</script>

<script type="text/javascript">
    layui.use('jquery',function () {
        var $ = layui.jquery;
        $(".check").click(function() {
            address_id = $(this).attr("address_id");
            that = $(this);
            $.ajax({
                url: '/changeAddress',
                type: 'POST',
                dataType: 'json',
                data: {address_id: address_id},
            })
            .done(function() {
                $(".check").parent().parent().removeClass('checked');
                that.parent().parent().addClass('checked');
            })
            .fail(function() {
                console.log("error");
            })
            
        });
        $(".deladdress").click(function() {
            address_id = $(this).attr("address_id");
            that = $(this);
            $.ajax({
                url: '/delAddress/'+address_id,
                type: 'POST',
                dataType: 'json',
                data: {address_id: address_id},
            })
            .done(function() {
                that.parent().parent().parent().remove();
            })
            .fail(function() {
                console.log("error");
            })
            
        });

    })

</script>

</body>
</html>